#include "Uuid.h"

#include <random>
#include <sstream>

namespace Engine2D
{    
    Uuid::Uuid()
    {
        std::random_device rd;
        std::mt19937_64 gen(rd());
        std::uniform_int_distribution<uint64_t> dis;
    
        uint64_t part1 = dis(gen);
        uint64_t part2 = dis(gen);
    
        std::ostringstream oss;
        oss << std::hex << part1 << part2;
    
        std::string uuidStr = oss.str();
        m_uuid = uuidStr.substr(0, 32); // 截取32位作为简化的UUID
    }
    
    Uuid::Uuid(const std::string &str)
        : m_uuid(str)
    {
        
    }
} // namespace Engine2D
